package example.p1;

import example.p2.Father1;

public class Son1 extends Father1 {

    @Override
    protected void fun() {
        System.out.println("Son1 fun is running");
    }

    public void show() throws CloneNotSupportedException {
        Son1 son1_1 = new Son1();
        son1_1.clone(); //自身实例调用protected修饰的clone方法,正确执行

        Object son1_2 = new Son1();
//        son1_2.clone();//多态形式调用protected修饰的clone方法,报错

        Object object = new Object();
//        object.clone();
    }

    @Override
    protected Object clone() throws CloneNotSupportedException {

        return" super.clone()";
    }

    public Object cloneOverride() throws CloneNotSupportedException {
        return super.clone();
    }
}
